//
//  YBMineViewModel.swift
//  Moonlight
//
//  Created by Penlon Kim on 2023/7/1.
//  Copyright © 2023 Moonlight Game Streaming Project. All rights reserved.
//

import UIKit

class YBMineViewModel: BaseViewModel {
    lazy var activationFrontModels = [YBActivationFrontModel]()
    lazy var oderModels = [YBOrderModel]()
}

// MARK: - 网络请求
extension YBMineViewModel {
    
    /// 订单列表
    func req_OrderList(_ params: [String : Any], handler: @escaping BKResultHandler) {
        self.postReq(path: NetApiPort.Order.orderPage, params: params, handler: handler)
    }
    
    /// 用户兑换明细
    func req_ActivationFrontList(_ params: [String : Any], handler: @escaping BKResultHandler) {
        self.postReq(path: NetApiPort.ActivationFront.page, params: params, handler: handler)
    }
    
    /// 兑换激活码
    func req_ExchangeCode(_ code: String, handler: @escaping BKResultHandler) {
        self.getReq(path: NetApiPort.ActivationFront.exchangeCode + "/" + code, handler: handler)
    }
    
    
    /// 推广海报图
    func req_QrBanner(handler: @escaping BKResultHandler) {
        self.getReq(path: NetApiPort.Qrcode.banner, handler: handler)
    }
    
    /// 推广二维码
    func req_QrCode(handler: @escaping BKResultHandler) {
        self.postReq(path: NetApiPort.Qrcode.code, handler: handler)
    }
    
    /// 关闭SSE
    func req_CloseSSE(handler: @escaping BKResultHandler) {
        self.getReq(path: NetApiPort.SSE.close + "/" + AppHelper.kUserId, handler: handler)
    }
}
